//
//  CTVHTTP.m
//  Channltv
//
//  Created by Bruno  Keymolen on 26/07/07.
//  Copyright 2007 channl.tv. All rights reserved.
//

#import "CTVHTTP.h"


@implementation CTVHTTP

-(NSString*)httpGet:(NSString*)urlString{
	NSString* ret;
	NSURL* url = [NSURL URLWithString:urlString];
	NSError *err=nil;	
	
	NSURLRequest* urlRequest=[NSURLRequest requestWithURL:url
							  cachePolicy:NSURLRequestUseProtocolCachePolicy
							  timeoutInterval:60.0];

	NSData* data = [NSURLConnection sendSynchronousRequest: urlRequest returningResponse:nil error:&err];

	char* b;
	
	b = malloc([data length]);
	 
	[data getBytes:b];

	ret = [NSString stringWithCString:b length:[data length]];

	free(b);
	
	return ret;
}

@end
